package com.github.ecbp.common.data;

import com.github.ecbp.common.data.interceptor.FeignInterceptor;
import com.github.ecbp.common.utils.SpringUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;

@SpringBootApplication
@EnableDiscoveryClient
@MapperScan({"com.github.ecbp.*.service.mapper"})
@EnableFeignClients("com.github.ecbp.*.service.feignapi")
@ComponentScan("com.github.ecbp")
// @EnableHystrix
@EnableConfigurationProperties
@PropertySource("classpath:application.properties")
public abstract class AbstractBaseApplication {
    private static final Logger logger = LoggerFactory.getLogger(AbstractBaseApplication.class);

    @Bean("SpringContextUtils")
    public SpringUtils springContextUtils(){
        return new SpringUtils();
    }

    @Bean
    public FeignInterceptor feignInterceptor() {
        return new FeignInterceptor();
    }
}
